package util

import "encoding/binary"

func BytesToUint16(buf []byte) []uint16 {
	//var short []uint16
	//for i := 0; i < len(buf); i += 2 {
	//	short = append(short, binary.BigEndian.Uint16(buf[i:i+2]))
	//}
	//return short
	short := make([]uint16, len(buf)/2)
	for i, _ := range short {
		short[i] = binary.BigEndian.Uint16(buf[i*2 : (i+1)*2])
	}
	return short
}
